using System;
using System.Data;
using Utils;
using Utils.DatabaseUtils;


namespace QLBH
{
public class tblKhachHangUI
{ 
	private int idKhachHang;
	public int IdKhachHang
	{
		get { return idKhachHang;}
		set { idKhachHang = value;}
	}

	private String tenKhachHang;
	public String TenKhachHang
	{
		get { return tenKhachHang;}
		set { tenKhachHang = value;}
	}

	private String diaChi;
	public String DiaChi
	{
		get { return diaChi;}
		set { diaChi = value;}
	}

	private String dienThoai;
	public String DienThoai
	{
		get { return dienThoai;}
		set { dienThoai = value;}
	}

	private String fax;
	public String Fax
	{
		get { return fax;}
		set { fax = value;}
	}

	private String email;
	public String Email
	{
		get { return email;}
		set { email = value;}
	}

	private DateTime ngaySinh;
	public DateTime NgaySinh
	{
		get { return ngaySinh;}
		set { ngaySinh = value;}
	}

	private bool gioiTinh;
	public bool GioiTinh
	{
		get { return gioiTinh;}
		set { gioiTinh = value;}
	}

	private String congViec;
	public String CongViec
	{
		get { return congViec;}
		set { congViec = value;}
	}

	private String ghiChu;
	public String GhiChu
	{
		get { return ghiChu;}
		set { ghiChu = value;}
	}

	private DateTime ngayTao;
	public DateTime NgayTao
	{
		get { return ngayTao;}
		set { ngayTao = value;}
	}

	private int idCuaHang;
	public int IdCuaHang
	{
		get { return idCuaHang;}
		set { idCuaHang = value;}
	}

	private bool hoatDong;
	public bool HoatDong
	{
		get { return hoatDong;}
		set { hoatDong = value;}
	}

	public tblKhachHangUI() {}

	public tblKhachHangUI(int idKhachHang, String tenKhachHang, String diaChi, String dienThoai, String fax, String email, DateTime ngaySinh, bool gioiTinh, String congViec, String ghiChu, DateTime ngayTao, int idCuaHang, bool hoatDong)
	 {
		this.idKhachHang = idKhachHang;
 		this.tenKhachHang = tenKhachHang;
 		this.diaChi = diaChi;
 		this.dienThoai = dienThoai;
 		this.fax = fax;
 		this.email = email;
 		this.ngaySinh = ngaySinh;
 		this.gioiTinh = gioiTinh;
 		this.congViec = congViec;
 		this.ghiChu = ghiChu;
 		this.ngayTao = ngayTao;
 		this.idCuaHang = idCuaHang;
 		this.hoatDong = hoatDong;
 	}

	public int Add(String tenKhachHang, String diaChi, String dienThoai, String fax, String email, DateTime ngaySinh, bool gioiTinh, String congViec, String ghiChu, DateTime ngayTao, int idCuaHang, bool hoatDong)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblKhachHang_Add",tenKhachHang,diaChi,dienThoai,fax,email,ngaySinh,gioiTinh,congViec,ghiChu,ngayTao,idCuaHang,hoatDong);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Update(int idKhachHang, String tenKhachHang, String diaChi, String dienThoai, String fax, String email, DateTime ngaySinh, bool gioiTinh, String congViec, String ghiChu, DateTime ngayTao, int idCuaHang, bool hoatDong)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblKhachHang_Update",idKhachHang,tenKhachHang,diaChi,dienThoai,fax,email,ngaySinh,gioiTinh,congViec,ghiChu,ngayTao,idCuaHang,hoatDong);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Delete(int idKhachHang)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblKhachHang_Delete",idKhachHang);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int DeleteAll()
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblKhachHang_DeleteAll");
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public DataSet Get(int idKhachHang)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblKhachHang_Get",idKhachHang);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetAll()
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblKhachHang_GetAll");
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetByIdCuaHang(int idCuaHang)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblKhachHang_GetByIdCuaHang",idCuaHang);
			return result;
		}
		catch(Exception e) {return null; }
	}

} 
}
